package com.ruoyi.modules.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SnowflakeIdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.modules.mapper.VehicleInfoMapper;
import com.ruoyi.modules.domain.VehicleInfo;
import com.ruoyi.modules.service.IVehicleInfoService;

/**
 * 车辆信息Service业务层处理
 * 
 * @author ssh
 * @date 2024-12-15
 */
@Service
public class VehicleInfoServiceImpl implements IVehicleInfoService 
{
    @Autowired
    private VehicleInfoMapper vehicleInfoMapper;

    /**
     * 查询车辆信息
     * 
     * @param id 车辆信息主键
     * @return 车辆信息
     */
    @Override
    public VehicleInfo selectVehicleInfoById(String id)
    {
        return vehicleInfoMapper.selectVehicleInfoById(id);
    }

    /**
     * 查询车辆信息列表
     * 
     * @param vehicleInfo 车辆信息
     * @return 车辆信息
     */
    @Override
    public List<VehicleInfo> selectVehicleInfoList(VehicleInfo vehicleInfo)
    {
        return vehicleInfoMapper.selectVehicleInfoList(vehicleInfo);
    }

    /**
     * 新增车辆信息
     * 
     * @param vehicleInfo 车辆信息
     * @return 结果
     */
    @Override
    public int insertVehicleInfo(VehicleInfo vehicleInfo)
    {
        SnowflakeIdUtils idWorker = new SnowflakeIdUtils(1, 3);
        vehicleInfo.setId(idWorker.nextId()+"");
        vehicleInfo.setCreateTime(DateUtils.getNowDate());
        return vehicleInfoMapper.insertVehicleInfo(vehicleInfo);
    }

    /**
     * 修改车辆信息
     * 
     * @param vehicleInfo 车辆信息
     * @return 结果
     */
    @Override
    public int updateVehicleInfo(VehicleInfo vehicleInfo)
    {
        vehicleInfo.setUpdateTime(DateUtils.getNowDate());
        return vehicleInfoMapper.updateVehicleInfo(vehicleInfo);
    }

    /**
     * 批量删除车辆信息
     * 
     * @param ids 需要删除的车辆信息主键
     * @return 结果
     */
    @Override
    public int deleteVehicleInfoByIds(String[] ids)
    {
        return vehicleInfoMapper.deleteVehicleInfoByIds(ids);
    }

    /**
     * 删除车辆信息信息
     * 
     * @param id 车辆信息主键
     * @return 结果
     */
    @Override
    public int deleteVehicleInfoById(String id)
    {
        return vehicleInfoMapper.deleteVehicleInfoById(id);
    }
}
